<template>
  <div class="dashboard-container">
    <component :is="currentRole"/>
  </div>
</template>

<script setup>
import AdminDashBoard from './admin/Index.vue'
import EditorDashBoard from './editor/Index.vue'
import {GetUserMessage} from "../../api/user";
import {onBeforeMount, onMounted} from "vue";
import {useStore} from "vuex";
// const  components = {AdminDashBoard,EditorDashBoard}
let currentRole = AdminDashBoard;
const store = useStore();
onMounted(() => {
  GetUserMessage().then(response => {
    store.commit('user/SET_SIGNATURE', response.data.signature);
    store.commit('user/SET_NICKNAME', response.data.nickName);
    store.commit('user/SET_AVATAR',response.data.avatar);
  })
})

</script>

<style scoped>

</style>